<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0, user-scalable=no,target-densitydpi=device-dpi,viewport-fit=cover">
<!-- <script>
    /*
     * 自动根据宽度计算根元素的font-size的数值，最大宽度限制为640px
     */
    (function (global, factory) {
        "use strict";
        if (typeof module === "object" && typeof module.exports === "object") {
            module.exports = factory(global, true);
        } else if (typeof define === 'function' && define.amd) {
            define(function () {
                return factory(global)
            })
        } else {
            factory(global);
        }
    }(typeof window !== "undefined" ? window : this, function (win) {
        var head = document.getElementsByTagName('head')[0];
        var ready = {};

        ready.init = function () {
            var el = ready.dv();
            document.documentElement.style.fontSize = ready.rem();
            el.remove();
            /* styl(ready.rem()); */
        }

        ready.rem = function () {
            var val = ready.wv() / 20 + "px";
            return val ? val : '100%';
        }

        ready.wv = function () {
            var w = win.innerWidth || document.body.clientWidth;
            return w >= 640 ? 640 : w;
        }

        ready.dv = function () {
            var el = document.createElement('div');
            el.style.width = '1rem';
            el.style.display = "none";
            head.appendChild(el);
            return el;
        }

        ready.styl = function (rem) {
            var el = document.createElement('style');
            el.setAttribute('id', 'stylFontSize');
            el.innerHTML = "@media all and (min-width: " + ready.wv() + "px){html{font-size:" + rem + ";}}";
            if (document.getElementById('stylFontSize')) {
                document.getElementById('stylFontSize').remove();
            }
            head.appendChild(el);
        }

        ready.start = function () {
            if (navigator.userAgent.indexOf('MSIE') < 0) {
                ready.init();
            } else {
                document.documentElement.style.fontSize = '100%';
            }
        }

        win.addEventListener("resize", function () {
            ready.start();
        });

        ready.start();
    }));
</script> -->

<div class="dsadas">

</div>

<style>
    .dsadas {
        height: 1rem;
        border: 1px solid;
    }
</style>

<script>
    !function (e, t) {
        var n = t.documentElement,
            d = e.devicePixelRatio || 1;

        console.log({ d });

        function i() {
            var e = n.clientWidth / 37.5;
            n.style.fontSize = e + "px"
        }
        if (
            function e() {
                t.body ? t.body.style.fontSize = "16px" : t.addEventListener("DOMContentLoaded", e)
            }(),
            i(),
            e.addEventListener("resize", i),
            e.addEventListener("pageshow", function (e) { e.persisted && i() }), d >= 2
        ) {
            var o = t.createElement("body"),
                a = t.createElement("div");
            a.style.border = ".5px solid transparent", o.appendChild(a), n.appendChild(o), 1 === a.offsetHeight && n.classList.add("hairlines"), n.removeChild(o)
        }
    }(window, document)

</script>
<div>
    我是div
</div>